<?php  if (!defined('BASEPATH')) exit('No direct script access allowed');

class MY_Validation extends CI_Validation {

    function __construct()
    {
        parent::CI_Validation();
    }
    
	/**
    * Error if there is a space
    */	
    function no_space($str)
	{
        return ( ! preg_match("#\s#", $str)) ? FALSE : TRUE;
    }

    
	public function date_sql($s)
	{
        $a = explode("-", $s);
        foreach($a as $v){
        	if (!ctype_digit($v)) return FALSE;
        }
        if($a[0] < 2007 || $a[0]>2100)  return FALSE;
        if($a[1] < 1    || $a[1]>12)    return FALSE;
        if($a[2] < 1    || $a[2]>31)    return FALSE;
        return TRUE;
    }

    
	/**
	 * Numeric with dashes 
	 *
	 * @access	public
	 * @param	string
	 * @return	bool
	 */	
	function numeric_dash($str)
	{
		return ( ! preg_match("/^([-0-9-])+$/i", $str)) ? FALSE : TRUE;
	}
	
	// --------------------------------------------------------------------


}
// END Validation Class
?>